import React, { Fragment } from 'react'
import {
  View,
  StyleSheet,
  Text,
  Animated,
  FlatList,
  Easing
} from 'react-native'
import { ScaleS, ScaleT, IS_IOS, IS_IPHONEX, WIDTH } from 'src/utils/ScreenUtil'
import BasePage from 'src/pageP/base/base-page/index'
import CustomImage from 'src/components/image/CustomImage'
import CustomButton from 'src/components/button/CustomButton'
import { ImageHost } from 'src/config/index'
import {
  recommendPost,
  updateJobStatus,
  delJobHunting,
  delEducation,
  delWork,
  delImg,
  insertImg,
  getAllTemplate,
  insertUserResume,
  updateUserResume,
  findUserResumeByUserIdAndPostId,
  findUserArchiveByArchiveId,
  cancelUpdate,
  talentTalk,
  insertArchiveCollection,
  removeArchiveCollection,
  talentTalkTime,
  findUserTemporaryResumeModel,
  myCenterNumbers
} from 'src/utils/RequestAPI'
import { isEmptyObjectFn, isArrayFn } from 'src/utils/JSTypeUtil'
import { CommonToast, DismissLoading, ShowLoading } from 'src/utils/ToastUtil'

/* redux */
import { connect } from 'react-redux'
import {
  DO_REQUEST_MAIN_PAGE_C_ACTION,
  DO_REQUEST_MY_CENTER_NUMBERS_ACTION,
  UPDATE_USER_ARCHIVE_EDUCATION_ACTION,
  UPDATE_USER_ARCHIVE_WORK_ACTION,
  UPDATE_USER_ARCHIVE_IMG_ACTION
} from './store/action'
import { DO_REQUEST_USERINFO_C_ACTION } from 'src/store/actions/userinfo'
import { unloginDefaultPortrait, getUserAvatorLocalC, getJobStatus } from 'src/utils/ConfigUtil'
import DefaultImage from 'src/components/image/DefaultImage'
import { TabBar, TabView } from 'react-native-tab-view'
import JobIntentionCardNew from 'src/components/card-job-intention-new'
import EducationInfoCardNew from 'src/components/card-education-info-new'
import WorkExperienceCardNew from 'src/components/card-work-experience-new'
import ActionSheetModal2 from 'src/components/modal/ActionSheetModal2'
import { jobStatusArr } from 'utils/ConfigUtil'
import { UPDATE_MAIN_PAGE_C_ACTION } from '@/pageC/mine/mine-page/store/action'
import ShareBtn from 'src/components/button/ShareBtn'
import { shareToWXMiniProgram } from 'src/utils/PayUtil'
import JobHuntingOperateModel from '@/components/modal/JobHuntingOperateModel'
import DealJobHuntingModal from '@/components/modal/DealJobHuntingModal'
import { showModal, showImageViewerModal, showTipModal, showSelectModal } from 'src/utils/ModalUtil'
import { openCamera, multipleAlums } from 'src/utils/ImagePickerUtil'
import { uploadImgs } from 'src/utils/ImageUploadUtil'
import { ONE_PIXEL } from '@/utils/ScreenUtil'
import CompanyTouchableOpacity from 'src/pageB/company/mine-company/components/CompanyTouchableOpacity'
import { getSchoolQuery } from 'src/utils/FuzzyQueryUtil'
import WhiteWrap from 'src/pageP/home/home-page/components/WhiteWrap'
import ThreeDotComponent from 'src/pageP/home/home-page/components/ThreeDotComponent'
import showPicker from 'src/utils/PickerUtil'
import { UPDATEIM } from 'src/store/types/im'
import address from 'src/utils/address'
import NavigationUtil from 'src/utils/NavigationUtil'
import { isEnv } from 'src/config/index'
import IMController from 'src/utils/IMController'

const mapActiontoProps = dispatch => ({
  doRequestUserInfoC(payload) {
    const promise = DO_REQUEST_USERINFO_C_ACTION(payload)
    dispatch(promise)
    return promise.payload
  },
  doRequestMainPage(...payload) {
    const promise = DO_REQUEST_MAIN_PAGE_C_ACTION(...payload)
    dispatch(promise)
    return promise.payload
  },
  doRequestMyCenterNumbers(payload) {
    const promise = DO_REQUEST_MY_CENTER_NUMBERS_ACTION(payload)
    dispatch(promise)
    return promise.payload
  },
  updateMainPageC(payload) {
    dispatch(UPDATE_MAIN_PAGE_C_ACTION(payload))
  },
  updateUserArchiveEducation(payload) {
    dispatch(UPDATE_USER_ARCHIVE_EDUCATION_ACTION(payload))
  },
  updateUserArchiveWork(payload) {
    dispatch(UPDATE_USER_ARCHIVE_WORK_ACTION(payload))
  },
  updateImState(payload) {
    dispatch({
      type: UPDATEIM,
      payload: {
        ...payload
      }
    })
  },
  updateUserArchiveImg(payload) {
    dispatch(UPDATE_USER_ARCHIVE_IMG_ACTION(payload))
  }
})

@connect(
  ({ userinfo, CMineCenterStore, landmark, BMineCenterStore }) => ({
    userinfo,
    roleC: userinfo.role === 'C',
    userinfoC: userinfo.C,
    userinfoB: userinfo.B,
    ...CMineCenterStore,
    companyId: BMineCenterStore.haveCompanyApply.companyId,
    isVip: BMineCenterStore.member.remainingDay > 0,
    landmark
  }),
  mapActiontoProps
)
class CMinePage extends BasePage {
  constructor(props) {
    super(props)
    this.selectModalConfig = {
      selectArr: [
        {
          label: '相册上传'
        },
        {
          label: '拍照上传'
        }],
      titleText: '添加照片',
      onCancel: this._selectModalCancel,
      selectClick: this._selectModalClick
    }
    const { navigation: { state: { params: { postId, userId } = {} } } } = this.props
    this.postId = postId
    this.userId = userId
    this.state = {
      resumeDetail: {},
      viewRef: null,
      header: {},
      recommendJob: [],
      scrollY: new Animated.Value(0),
      index: 0,
      routes: [
        { key: 'resume', title: '' }
      ],
      jobIntentionVisible: false,
      modalDealState: '',
      modalShowStatus: '',
      modelActiveIndex: 0,
      initIndex: 0,
      dataPhotoArr: [],
      checkedIds: [],
      templateList: [],
      resumeId: null,
      logoShow: false,
      showBottomBtn: false,
      showBottomBtnHeight: 200,
      resumeType: 0,
      myCenterNumbers: {}
    }
    this.logoAnimatedValue = new Animated.Value(0)
  }
  getUserInfo = async () => {
    const userinfo = await DO_REQUEST_USERINFO_C_ACTION({
      params: {
        userId: this.userId
      }
    }).payload
    const mainPage = await DO_REQUEST_MAIN_PAGE_C_ACTION({
      params: {
        userId: this.userId
      }
    }).payload
    return {
      userinfoC: userinfo.C,
      userAvatorSource: userinfo.C.userAvator,
      ...mainPage
    }
  }
  componentWillUnmount() {
    this.props.navigation.state.params.callback && this.props.navigation.state.params.callback(this.state.resumeType)
  }

  componentDidMount() {
    const {
      userinfo: { userId },
      roleC
    } = this.props
    if (roleC) {
      getAllTemplate({ params: { channelId: this.props.navigation.state.params.channelId } }).then((data) => {
        findUserTemporaryResumeModel({ params: { userId } }).then((resume) => {
          (data.data || []).map((item) => {
            (resume.data || []).map((resumeItem) => {
              if (item.abbreviation == resumeItem.abbreviation) {
                item.text = resumeItem.text
              }
            })
          })
          this.setState({
            templateList: data.data
          })
        }).catch((e) => {
          this.setState({
            templateList: data.data
          })
        })
      })
    }
  }
  createWyAccount = resumeDetail => {
    // 创建网易云信账号
    const {
      userArchiveModel: { userId, userName, userAvator, gender, mobile }
    } = resumeDetail
    const identifier = userId + 'c' + isEnv
    const userInfo = {
      userName,
      userAvator,
      userId,
      gender,
      mobile
    }
    console.log('asdadaasdasdas')
    if (userId) {
      IMController.createAccount({
        userId: identifier,
        role: 'C',
        userInfo
      }).then(() => {
        console.log(this.props.selToID, 'toididid')
      })
    }
  }
  findIsCollection = (resumeDetail) => {
    const {
      archiveInfo: { archiveId }
    } = resumeDetail
    const { userinfoB: { userId } = {} } = this.props
    if (!userId) return
    findUserArchiveByArchiveId({
      params: {
        archiveId,
        userId
      }
    }).then((data) => {
      console.info(data)
      const { data: { archiveId, postId } = {} } = data
      if (archiveId) {
        this.setState({
          collectionId: archiveId
        })
      }
      if (postId) {
        this.postId = postId
      }
    })
  }

  componentWillFocus(payload) {
    const {
      userinfo: { userId },
      doRequestUserInfoC,
      doRequestMainPage,
      doRequestMyCenterNumbers
    } = this.props
    if (this.userId) {
      ShowLoading()
      this.getUserInfo().then((data) => {
        DismissLoading()
        this.setState({
          resumeDetail: data,
          showPortrait: true
        }, () => {
          this.getCenterNumbers()
        })
        this.findIsCollection(data)
        // 创建网易云信账号
        console.log(data, 'data')
        this.createWyAccount(data)
      }).catch(() => {
        DismissLoading()
      })
      const { companyId } = this.props
      companyId && talentTalkTime({ params: { companyId } }).then((data) => {
        this.setState({
          talentTalkTime: data.data
        })
      })
    }
    if (this.props.roleC) {
      if (userId) {
        doRequestUserInfoC({ params: { userId } }).finally(() => {
          const { userinfo: { C: { userId: userIdC } }, archiveInfo: { archiveId } = {} } = this.props
          if (userIdC) {

            doRequestMainPage({ params: { userId } }).then(() => {
              this.setState({
                dataPhotoArr: this._transformDataArr()
              })
            })
            doRequestMyCenterNumbers({ type: 'C', userId, archiveId })
          }
        })
      } else {
        this.setState({
          dataPhotoArr: []
        })
      }
    } else {
      doRequestUserInfoC({ params: { userId: this.props.navigation.state.params.userId } }).finally(() => {
        if (this.props.navigation.state.params.userId) {
          doRequestMainPage({ params: { userId: this.props.navigation.state.params.userId } }).then(() => {
            this.setState({
              dataPhotoArr: this._transformDataArr()
            })
          })
        }
      })
      this.getfindUserResumeByUserId()
    }
  }

  getfindUserResumeByUserId = () => {
    const { userId, channelId, postId } = this.props.navigation.state.params
    findUserResumeByUserIdAndPostId({ params: { userId, channelId, postId } }).then((data) => {
      this.setState({ templateList: JSON.parse(data.data.userResume), resumeId: data.data.id, resumeType: data.data.type })
    })
  }

  /* 请求个人中心数据量 */
  getCenterNumbers = () => {
    const { resumeDetail: { userinfoC: { userId }, archiveInfo: { archiveId } } = {} } = this.state
    return new Promise((resolve, reject) => {
      myCenterNumbers({ params: { type: 'C' }, headers: { userId, archiveId } }).then(res => {
        if (res.code === 200) {
          this.setState({
            myCenterNumbers: res.data
          })
          resolve({ myCenterNumbers: res.data })
        } else {
          reject(res)
        }
      })
    })
  }
  updateUserinfoC = () => {
    const {
      userinfo: { userId },
      doRequestUserInfoC
    } = this.props
    !!userId &&
      doRequestUserInfoC({ params: { userId } }).then(res => {
        // todo
        if (isEmptyObjectFn(res)) {
          CommonToast('请完善个人信息').then(() => {
            this.props.navigation.navigate(`CFirstUserInfo`)
          })
        }
      })
  }
  _onScroll = (event) => {
    const { scrollBeginState, scrollBeginY, scrollRange, logoShow, showBottomBtn, showBottomBtnHeight } = this.state
    const {
      contentOffset: { y = 0 } = {}
    } = event.nativeEvent
    // 展示底部沟通按钮
    if (y > showBottomBtnHeight && !showBottomBtn) {
      this.setState({
        showBottomBtn: true
      })
    } else if (y <= showBottomBtnHeight && showBottomBtn) {
      this.setState({
        showBottomBtn: false
      })
    }
  }
  showLogo = () => {
    // 展示底部按钮上面的图片
    this.logoAnimatedValue.setValue(0)
    Animated.timing(this.logoAnimatedValue, {
      toValue: 1,
      duration: 500,
      easing: Easing.ease
    }).start()
  }
  hideLogo = () => {
    // 隐藏底部按钮上面的图片
    this.logoAnimatedValue.setValue(1)
    Animated.timing(this.logoAnimatedValue, {
      toValue: 0,
      duration: 500,
      easing: Easing.ease
    }).start(() => {
      this.setState({
        logoShow: false
      })
    })
  }
  _onScrollBeginDrag = (event) => {
  }
  _onScrollEndDrag = (event) => {
    this._onMomentumScrollEnd(event)
  }
  _onMomentumScrollEnd = event => {
    const { logoShow } = this.state
    const {
      contentOffset: { y = 0 } = {},
      contentSize: { height: contentSizeHeight },
      layoutMeasurement: { height: oriageScrollHeight }
    } = event.nativeEvent
    if (y + oriageScrollHeight < contentSizeHeight && logoShow) {
      this.setState({
        logoShow: false
      })
      this.hideLogo()
    } else if (y + oriageScrollHeight >= contentSizeHeight && !logoShow) {
      this.setState({
        logoShow: true
      })
      this.showLogo()
    }
  }
  childRender() {
    const {
      userinfoC,
      userArchiveModel
    } = this.props
    const { jobIntentionVisible, collectionId, logoShow, showBottomBtn, resumeType, myCenterNumbers } = this.state
    return (
      <Fragment>
        <Animated.ScrollView
          style={styles.container}
          showsVerticalScrollIndicator={false}
          onScroll={
            Animated.event([{
              nativeEvent: { contentOffset: { y: this.state.scrollY } }
            }], {
              useNativeDriver: IS_IOS,
              listener: this._onScroll
            })}
          onScrollBeginDrag={this._onScrollBeginDrag}
          onScrollEndDrag={this._onScrollEndDrag}
          onMomentumScrollEnd={this._onMomentumScrollEnd}
        >
          <View style={styles.titleView}>
            <View style={styles.titleLeft}>
              <CustomButton
                style={styles.titleCenterView}
                onPress={this._jumpBaseMessage}
              >
                <Text style={styles.titleCenterName}>
                  {userinfoC.userId
                    ? userinfoC.userName
                    : '无名之辈'}
                </Text>
              </CustomButton>
              <CustomButton style={styles.jobHuntingView} onPress={this.showSelect}>
                {getJobStatus(userArchiveModel.jobStatus) === '寻找工作' && <CustomImage
                  style={styles.jobHuntingImg}
                  source={require('@/imgC/userinfo/hunting_find.png')}
                />}
                {getJobStatus(userArchiveModel.jobStatus) === '考虑机会' && <CustomImage
                  style={styles.jobHuntingImg}
                  source={require('@/imgC/userinfo/hunting_think.png')}
                />}
                <Text style={styles.jobHuntingText}>{getJobStatus(userArchiveModel.jobStatus) || '太懒了，还没有求职状态…'}</Text>
              </CustomButton>
            </View>

            <CustomButton
              style={styles.titlePortraitBtn}
              onPress={this._jumpAvator}
            >
              {
                userinfoC.userId ? (
                  <DefaultImage
                    style={styles.titlePortraitImg}
                    source={{ uri: userinfoC.userAvator }}
                    errorSource={getUserAvatorLocalC(
                      userinfoC.gender,
                      userinfoC.userId
                    )}
                  />
                ) : (
                    <CustomImage style={styles.titlePortraitImg} source={unloginDefaultPortrait} />
                  )
              }
            </CustomButton>
          </View>
          {!this.props.roleC && <View style={styles.infoContainer}>
            <View style={styles.infoContainerLeft}>
              <CustomButton style={styles.followInfo} onPress={this.goJobCollection}>
                <Text style={styles.followInfoTop}>{myCenterNumbers.postCollection || 0}</Text>
                <Text style={styles.followInfoBottom}>关注</Text>
              </CustomButton>
              <CustomButton style={styles.followInfo}>
                <Text style={styles.followInfoTop}>{myCenterNumbers.archiveCollection || 0}</Text>
                <Text style={styles.followInfoBottom}>被关注</Text>
              </CustomButton>
            </View>
            <View style={styles.infoContainerRight}>
              <CustomButton style={styles.followBtn} params={!!collectionId} onPress={this._onCollected}>
                {collectionId
                  ? <CustomImage style={styles.itemCloseImg} source={require('@/imgC/userinfo/icon_white_ok.png')} />
                  : <Text style={styles.followBtnText}>+</Text>}
              </CustomButton>
              <CustomButton style={styles.goChatBtn} onPress={this.goChat}>
                <Text style={styles.goChatBtnText}>沟通</Text>
              </CustomButton>
            </View>
          </View>}
          <TabView
            style={styles.tabView}
            navigationState={this.state}
            renderScene={this._renderScene}
            onIndexChange={this._onIndexChange}
            renderTabBar={this._renderTabBar}
          />
        </Animated.ScrollView>
        {
          !this.props.roleC && !!showBottomBtn && (
            <View style={styles.communicateContainer}>
              {logoShow && <Animated.View style={[styles.communicateLogo, { opacity: this.logoAnimatedValue }]}>
                <CustomImage style={styles.communicateLogoImg} source={require('@/imgC/post/postDetail.png')} />
              </Animated.View>}
              <View style={styles.communicateOutView}>
                <View style={styles.activeTime}>
                  {/* <View style={styles.activeTimeDot}></View> */}
                  <Text style={styles.activeTimeText}>{resumeType === 2 ? '录用中...' : resumeType === 0 ? '审核中...' : resumeType == 3 ? '初试中...' : resumeType == 4 ? '复试中...' : resumeType == 5 ? '三试中...' : resumeType == 6 ? '四试中...' : ''} {resumeType == 1 && '不合适'}</Text>
                </View>
                <View style={styles.communicateRightView}>
                  {!!(resumeType !== 2 && resumeType !== 1) && <CustomButton onPress={this._threeDotPress} style={styles.roleBTopViewRight}>
                    <Text style={styles.roleBViewText}>操作</Text>
                  </CustomButton>}
                  {!!(resumeType == 1) && <CustomButton onPress={this.cancelUpdate} style={styles.roleBTopViewRight}>
                    <Text style={styles.roleBViewText}>取消</Text>
                  </CustomButton>}
                  <CustomButton style={styles.roleBTopViewRight} onPress={this.goChat}>
                    <Text style={styles.communicateLabel}>沟通</Text>
                  </CustomButton>
                </View>
              </View>
            </View>
          )
        }
        <ActionSheetModal2
          visible={jobIntentionVisible}
          selectArr={jobStatusArr}
          onCancel={this.onCancel}
          selectClick={this.selectClick}
          onModalHide={this.onModalHide}
          titleText={'求职状态'}
        />
        {
          this.props.roleC && <View style={styles.bottom}>
            <CustomButton onPress={this.throw} style={styles.bottomBotton}>
              <Text style={styles.bottomBottonText}>投递</Text>
            </CustomButton>
          </View>
        }
      </Fragment>
    )
  }
  _goChatPageB = () => {
    this._getPostId().then(postId => {
      this._talentTalkToChatPage(postId)
    })
  }
  _talentTalkToChatPage = (postId) => {
    const params = {
      type: 'B',
      cmpUserId: this.userId,
      companyId: this.props.companyId,
      userId: this.props.userinfoB.userId
    }
    if (postId) {
      params.postId = postId
    }
    talentTalk({
      params
    }).then(() => {
      NavigationUtil.navigate('ChatPageB', {
        postId
      })
    })
  }
  _getPostId = () => {
    // 获取postId
    return new Promise(resolve => {
      if (parseInt(this.postId) >= 0) { // 没有传递的
        resolve(this.postId)
      } else if (parseInt(this.type) >= 0) { // 传递过来了
        this._checkPost((defaultPost) => {
          resolve(defaultPost.postId)
        })
      } else {
        resolve()
      }
    })
  }
  goChat = () => {
    // 点击立即沟通
    const { isVip, userinfo: { role } } = this.props
    const { talentTalkTime } = this.state
    this.props.updateImState({
      msgArray: []
    })
    if (role === 'B' && !this._loginJump()) {
      if (isVip) {
        // 判断是否发布了岗位，如果发布了，就去聊天，否则应该去发布岗位
        this._goChatPageB()
      } else {
        if (talentTalkTime > 0) {
          const modal = showTipModal({
            titleText: '提示',
            contentText: `非会员拥有3次免费沟通机会，你已经沟通过${3 - Math.max(talentTalkTime, 0)}次${
              talentTalkTime > 0 ? `，还有${talentTalkTime}次免费沟通机会` : ''
              }`,
            confirmText: '沟通',
            cancelText: '升级会员',
            onConfirm: () => {
              this.props.navigation.navigate('ChatPageB')
              talentTalk({
                params: {
                  type: 'B',
                  cmpUserId: this.userId,
                  companyId: this.props.companyId,
                  userId: this.props.userinfoB.userId
                }
              })
              modal.close()
            },
            onCancel: () => {
              this.props.navigation.navigate('BMemberOpen')
              modal.close()
            }
          })
        } else {
          const modal = showTipModal({
            titleText: '提示',
            contentText: '您当前为企业非会员用户，3次免费沟通已用完。成为会员用户，拥有超多会员权限哦～',
            confirmText: '升级会员',
            cancelText: '取消',
            onConfirm: () => {
              this.props.navigation.navigate('BMemberOpen')
              modal.close()
            },
            onCancel: () => {
              modal.close()
            }
          })
        }
      }
    }
  }

  _onCollected = (isCollected) => {
    const { userinfo: { role } } = this.props
    if (role === 'B') {
      if (!this._loginJump()) {
        if (isCollected) {
          this.unFavoriteClick()
        } else {
          this.favoriteClick()
        }
      }
    }
  }

  // 取消收藏
  unFavoriteClick = () => {
    const { collectionId } = this.state
    const { userinfoB: { userId } } = this.props
    removeArchiveCollection({
      params: {
        ids: collectionId.toString(),
        userId
      }
    }).then(() => {
      CommonToast('取消收藏成功')
      this.getCenterNumbers()
      this.setState({
        collectionId: null
      })
    })
  }
  // 收藏
  favoriteClick = () => {
    if (parseInt(this.postId) >= 0) {
      this._insertArchiveCollection(this.postId)
    } else if (parseInt(this.type) >= 0) {
      this._checkPost((defaultPost) => {
        this._insertArchiveCollection(defaultPost.postId)
      })
    } else {
      this._insertArchiveCollection()
    }
  }
  /**
 * 插入收藏
 * @param postId
 * @private
 */
  _insertArchiveCollection = (postId) => {
    const { resumeDetail: { archiveInfo } = {} } = this.state
    if (!archiveInfo || !archiveInfo.archiveId) {
      return
    }
    const { userinfoB: { userId } } = this.props
    const params = {
      archiveId: archiveInfo.archiveId,
      userId
    }
    if (postId) {
      params.postId = postId
    }
    insertArchiveCollection({
      params
    }).then(() => {
      CommonToast('收藏成功')
      this.getCenterNumbers()
      this.setState({
        collectionId: archiveInfo.archiveId
      })
    })
  }
  // 投递简历
  throw = () => {
    this._archiveJump().then(() => {
      const errList = []
      this.state.templateList.map((item) => {
        if (!item.text) {
          errList.push(item.resumeTemplateName)
        }
      })
      if (errList.length > 0) {
        CommonToast(`请填写${errList[0]}`)
        return
      }
      insertUserResume({
        params: {
          channelId: this.props.navigation.state.params.channelId,
          postId: this.props.navigation.state.params.postId,
          userId: this.props.userinfoC.userId,
          userResume: JSON.stringify(this.state.templateList)
        }
      }).then((data) => {
        this.props.navigation.goBack()
        CommonToast('投递成功')
      })
    })
  }

  _archiveJump = () => {
    // 根据该用户建立完成度判断跳转
    return new Promise((resolve, reject) => {
      const {
        jobHuntingModels = [],
        intro,
        educations = [],
        userArchiveWorkModels = []
      } = this.props
      if (jobHuntingModels.length === 0) {
        const modal = showTipModal({
          titleText: '温馨提示',
          contentText: '您的求职意愿信息不完善，无法进行投递，快去完善简历吧',
          confirmText: '去完善',
          cancelText: '取消',
          onConfirm: () => {
            this.props.navigation.navigate('CFirstUserInfo', {
              fromJobdetail: true
            })
            modal.close()
          },
          onCancel: () => {
            modal.close()
          }
        })
        reject()
        return
      }
      if (!intro) {
        const modal = showTipModal({
          titleText: '温馨提示',
          contentText: '您的自我评价信息不完善，无法进行投递，快去完善简历吧',
          confirmText: '去完善',
          cancelText: '取消',
          onConfirm: () => {
            this.props.navigation.navigate('CFirstUserInfo', {
              fromJobdetail: true
            })
            modal.close()
          },
          onCancel: () => {
            modal.close()
          }
        })
        reject()
        return
      }
      if (educations.length === 0 && userArchiveWorkModels.length === 0) {
        const modal = showTipModal({
          titleText: '温馨提示',
          contentText: '您的教育信息不完善，无法进行投递，快去完善简历吧',
          confirmText: '去完善',
          cancelText: '取消',
          onConfirm: () => {
            this.props.navigation.navigate('CEducationInfoManager')
            modal.close()
          },
          onCancel: () => {
            modal.close()
          }
        })
        reject()
        return
      }
      resolve()
    })
  }

  renderNavigationBarChild = () => {
    const { userName } = this.props.userinfoC
    const { scrollY } = this.state
    return (
      <Fragment >
        {/* <View style={styles.topText}>
          <ShareBtn style={styles.shareBtn} onPress={this._onShared} />
        </View> */}
      </Fragment>
    )
  }

  _onShared = () => {
    const { userinfo: { userId }, userinfoC: { userName: title } } = this.props
    if (userId && title) {
      shareToWXMiniProgram({ title, shareUrl: `pages/person-detail/index?userId=${userId}&share=app` })
    }
  }

  // 更改求职状态
  showSelect = () => {
    // !this._loginJump() && this.setState({
    //   jobIntentionVisible: true
    // })
  }

  onCancel = () => {
    this.setState({
      jobIntentionVisible: false
    })
  }

  selectClick = () => {
    this.setState({
      jobIntentionVisible: false
    })
  }

  onModalHide = index => {
    if (!index) {
      return
    }
    index = index - 1
    const { userinfo: { userId }, userArchiveModel } = this.props
    const { id: archiveId } = userArchiveModel
    const params = {
      userId,
      archiveId,
      jobStatus: jobStatusArr[index].value
    }
    ShowLoading()
    updateJobStatus({ params }).then(() => {
      this.setState({
        jobIntentionVisible: false
      })
      this.props.updateMainPageC({
        userArchiveModel: {
          ...userArchiveModel,
          jobStatus: jobStatusArr[index].value
        }
      })
    }).finally(() => {
      DismissLoading()
    })
  }

  _loginJump = () => {
    const {
      userinfo: { userId, C: { userId: userIdC } = {} }
    } = this.props
    if (!userId) {
      this.props.navigation.navigate('OneLogin')
      return true
    }
    if (!userIdC) {
      this.props.navigation.navigate('CFirstUserInfo')
      return true
    }
  }

  // 更改用户头像
  _jumpAvator = () => {
    if (this.props.roleC) {
      !this._loginJump() && this.props.navigation.navigate('CUserAvator')
    }
  }

  // 更改用户名称
  _jumpBaseMessage = () => {
    if (this.props.roleC) {
      !this._loginJump() && this.props.navigation.navigate('CUserInfoBasic')
    }
  }

  // 填写自我评价
  _jumpSelfEvaluationPage = () => {
    (!this._loginJump() && this.props.roleC) &&
      this.props.navigation.navigate('CUserSelfEvalution', {
        title: '自我评价',
        desc: '*充分展现自我优势，让更多企业发现你',
        placeholder: '请输入自我评价',
        maxLength: 140,
        multiline: true,
        inputTextStyle: {
          minHeight: ScaleS(150)
        }
      })
  }

  _jumpIntentionPage = () => {
    if (!this._loginJump() && this.props.roleC) {
      const { jobHuntingModels } = this.props
      this.jobHuntingModel = showModal(
        <JobHuntingOperateModel
          dataArr={jobHuntingModels || []}
          type={'jobHunting'}
          addJobHunting={this._addJobHunting}
          editJobHunting={this._editJobHunting}
          deleteJobHunting={this._deleteJobHunting} />)
    }
  }

  _addJobHunting = () => {
    // 添加求职意向
    this.jobHuntingModel.close()
    this.props.navigation.navigate('CUserJobIntentionEdit', {
      jobIntention: {}
      // callback
    })
  }

  _editJobHunting = () => {
    // 编辑求职意向
    const { jobHuntingModels } = this.props
    this.jobHuntingModel.close(() => {
      this.dealJobHuntingModel = showModal(
        <DealJobHuntingModal
          dataStatus={'jobHunting'}
          dataArr={jobHuntingModels}
          modelActiveIndex={0}
          modalDealState={'edit'}
          onClickModelItem={this._onClickModelItem}
          onClickModelBtn={this._onClickModelBtn}
        />)
      this.setState({
        modalDealState: 'edit',
        modalShowStatus: 'jobHunting',
        modelActiveIndex: 0
      })
    })
  }

  _deleteJobHunting = () => {
    // 删除求职意向
    const { jobHuntingModels } = this.props
    this.jobHuntingModel.close(() => {
      this.dealJobHuntingModel = showModal(
        <DealJobHuntingModal
          dataStatus={'jobHunting'}
          dataArr={jobHuntingModels}
          modelActiveIndex={0}
          modalDealState={'delete'}
          onClickModelItem={this._onClickModelItem}
          onClickModelBtn={this._onClickModelBtn}
        />)
      this.setState({
        modalDealState: 'delete',
        modalShowStatus: 'jobHunting',
        modelActiveIndex: 0
      })
    })
  }

  _onClickModelItem = (index) => {
    // 点击弹窗item
    const { modalShowStatus } = this.state
    if (modalShowStatus === 'photo') {
      this.setState({
        checkedIds: index
      })
    } else {
      this.setState({
        modelActiveIndex: index
      })
    }
  }

  _onClickModelBtn = () => {
    // 点击弹窗按钮
    const { modelActiveIndex, modalDealState, modalShowStatus } = this.state
    switch (modalShowStatus) {
      case 'jobHunting':
        this.dealJobHuntingModel.close(() => {
          const { jobHuntingModels } = this.props
          const jobIntention = jobHuntingModels[modelActiveIndex]
          const callback = newJobIntention => {
            if (newJobIntention) {
              this.props.updateMainPageC({
                jobHuntingModels: jobHuntingModels.map(f => f.id === newJobIntention.id ? newJobIntention : f)
              })
            } else {
              this.props.updateMainPageC({
                jobHuntingModels: jobHuntingModels.filter(f => f.id !== jobIntention.id)
              })
            }
          }
          switch (modalDealState) {
            case 'edit':
              this.props.navigation.navigate('CUserJobIntentionEdit', {
                jobIntention,
                callback
              })
              break
            case 'delete':
              const {
                userinfoC: { userId }
              } = this.props

              /* 删除 */
              const params = {
                id: jobIntention.id,
                userId
              }
              ShowLoading()
              delJobHunting({ params }).then(res => {
                !!callback && callback()
              }).finally(() => {
                DismissLoading()
              })
              break
            default:
              CommonToast('其他操作')
              break
          }
        })
        break
      case 'education':
        this.dealEducationModel.close(() => {
          const { educations } = this.props
          const educationsItem = educations[modelActiveIndex]
          switch (modalDealState) {
            case 'edit':
              this.props.navigation.navigate('CEducationInfoManager', {
                education: educationsItem,
                showDelete: educations.length > 1
              })
              break
            case 'delete':
              const { userinfoC: { userId } } = this.props
              const params = {
                id: educationsItem.id,
                userId
              }
              delEducation({ params }).then(() => {
                CommonToast('删除成功')
                const educationsNew = educations.filter((item) => {
                  return item.id !== educationsItem.id
                })
                this.props.updateUserArchiveEducation({
                  educations: educationsNew
                })
              })
              break
            default:
              CommonToast('其他操作')
              break
          }
        })
        break
      case 'work':
        this.dealWorkExperienceModel.close(() => {
          const { userArchiveWorkModels } = this.props
          const workItem = userArchiveWorkModels[modelActiveIndex]
          switch (modalDealState) {
            case 'edit':
              this.props.navigation.navigate('CWorkExperienceManager', {
                workExperience: workItem,
                showDelete: userArchiveWorkModels.length > 1
              })
              break
            case 'delete':
              const { userinfoC: { userId } } = this.props
              const params = {
                id: workItem.id,
                userId
              }
              delWork({ params }).then(() => {
                CommonToast('删除成功')
                const userArchiveWorkModelsNew = userArchiveWorkModels.filter((item) => {
                  return item.id !== workItem.id
                })
                this.props.updateUserArchiveWork({
                  userArchiveWorkModels: userArchiveWorkModelsNew
                })
              })
              break
            default:
              CommonToast('其他操作')
              break
          }
        })
        break
      case 'photo':
        this.dealPhotoModel.close(() => {
          const { checkedIds, dataPhotoArr } = this.state
          const { userinfoC, updateUserArchiveImg } = this.props
          delImg({
            params: {
              userId: userinfoC.userId,
              ids: checkedIds.join(',')
            }
          }).then(() => {
            CommonToast('照片删除成功')
            const remainDatas = dataPhotoArr.reduce((newDataArr, currentValue) => {
              return checkedIds.includes(currentValue.id) ? newDataArr : newDataArr.concat(currentValue)
            }, [])
            this.setState({
              checkedIds: [],
              dataPhotoArr: remainDatas
            })
            updateUserArchiveImg({
              userArchiveImgModels: remainDatas
            })
          })
        })
        break
    }
  }

  _jumpEducationPage = () => {
    // 操作教育信息
    if (this._loginJump()) return
    if (this.props.roleC) {
      const { educations } = this.props
      this.educationModel = showModal(
        <JobHuntingOperateModel
          type={'education'}
          dataArr={educations || []}
          addJobHunting={this._addEducation}
          editJobHunting={this._editEducation}
          deleteJobHunting={this._deleteEducation} />)
    }
  }

  _addEducation = () => {
    // 增加教育信息
    this.educationModel.close()
    const { navigation, educations } = this.props
    navigation.navigate('CEducationInfoManager')
  }

  _editEducation = () => {
    // 修改教育信息
    const { educations } = this.props
    this.educationModel.close(() => {
      this.dealEducationModel = showModal(
        <DealJobHuntingModal
          dataArr={educations}
          dataStatus={'education'}
          modelActiveIndex={0}
          modalDealState={'edit'}
          onClickModelItem={this._onClickModelItem}
          onClickModelBtn={this._onClickModelBtn}
        />)
      this.setState({
        modalDealState: 'edit',
        modalShowStatus: 'education',
        modelActiveIndex: 0
      })
    })
  }

  _deleteEducation = () => {
    // 删除教育信息
    const { educations } = this.props
    this.educationModel.close(() => {
      this.dealEducationModel = showModal(
        <DealJobHuntingModal
          dataArr={educations}
          dataStatus={'education'}
          modelActiveIndex={0}
          modalDealState={'delete'}
          onClickModelItem={this._onClickModelItem}
          onClickModelBtn={this._onClickModelBtn}
        />)
      this.setState({
        modalDealState: 'delete',
        modalShowStatus: 'education',
        modelActiveIndex: 0
      })
    })
  }

  _jumpWorkExperience = () => {
    if (this._loginJump()) return
    if (this.props.roleC) {
      const { userArchiveWorkModels } = this.props
      this.workExperienceModel = showModal(
        <JobHuntingOperateModel
          type={'work'}
          dataArr={userArchiveWorkModels || []}
          addJobHunting={this._addWorkExperience}
          editJobHunting={this._editWorkExperience}
          deleteJobHunting={this._deleteWorkExperience} />)
    }
  }

  _addWorkExperience = () => {
    // 添加工作经验
    this.workExperienceModel.close()
    const { navigation, userArchiveWorkModels } = this.props
    navigation.navigate('CWorkExperienceManager')
  }

  _editWorkExperience = () => {
    // 修改工作经验
    const { userArchiveWorkModels } = this.props
    this.workExperienceModel.close(() => {
      this.dealWorkExperienceModel = showModal(
        <DealJobHuntingModal
          dataStatus={'work'}
          dataArr={userArchiveWorkModels}
          modelActiveIndex={0}
          modalDealState={'edit'}
          onClickModelItem={this._onClickModelItem}
          onClickModelBtn={this._onClickModelBtn}
        />)
      this.setState({
        modalDealState: 'edit',
        modalShowStatus: 'work',
        modelActiveIndex: 0
      })
    })
  }

  _deleteWorkExperience = () => {
    // 删除工作经验
    const { userArchiveWorkModels } = this.props
    this.workExperienceModel.close(() => {
      this.dealWorkExperienceModel = showModal(
        <DealJobHuntingModal
          dataStatus={'work'}
          dataArr={userArchiveWorkModels}
          modelActiveIndex={0}
          modalDealState={'delete'}
          onClickModelItem={this._onClickModelItem}
          onClickModelBtn={this._onClickModelBtn}
        />)
      this.setState({
        modalDealState: 'delete',
        modalShowStatus: 'work',
        modelActiveIndex: 0
      })
    })
  }

  /**
   * 操作相册
   * @returns {*}
   * @private
   */
  _jumpMyPhoneAlbums = () => {
    if (this._loginJump()) return
    if (this.props.roleC) {
      const { userArchiveImgModels } = this.props
      this.photoModel = showModal(
        <JobHuntingOperateModel
          type={'photo'}
          dataArr={userArchiveImgModels || []}
          addJobHunting={this._addPhoto}
          deleteJobHunting={this._deletePhoto} />)
    }
  }

  _addPhoto = () => {
    // !this._loginJump() && this.props.navigation.navigate('CMyPhotoAlbums')
    this.photoModel.close(() => {
      this._toggleSelectModal(true)
    })
  }

  _deletePhoto = () => {
    // 删除相册
    const { userArchiveImgModels } = this.props
    this.photoModel.close(() => {
      this.dealPhotoModel = showModal(
        <DealJobHuntingModal
          dataStatus={'photo'}
          dataArr={userArchiveImgModels}
          modelActiveIndex={0}
          modalDealState={'delete'}
          onClickModelItem={this._onClickModelItem}
          onClickModelBtn={this._onClickModelBtn}
        />)
      this.setState({
        modalDealState: 'delete',
        modalShowStatus: 'photo',
        modelActiveIndex: 0
      })
    })
  }

  _toggleSelectModal = (selectModalShow, callBack) => {
    if (selectModalShow) {
      this.selectModal = showSelectModal(this.selectModalConfig)
    } else {
      if (this.selectModal) {
        this.selectModal.close(() => {
          callBack && callBack()
        })
      }
    }
  }

  _selectModalCancel = () => {
    this._toggleSelectModal(false)
  }

  _selectModalClick = index => {
    switch (index) {
      case 0:
        this.selectModal.close(() => {
          multipleAlums().then((images) => {
            this._addImage(images)
          })
        })
        break
      case 1:
        this.selectModal.close(() => {
          openCamera({
            width: 750, height: 750
          }).then((image) => {
            this._addImage(image)
          })
        })
        break
      default:
        this.selectModal.close()
    }
  }

  _addImage = (img) => {
    if (isArrayFn(img)) {
      this._uploadImages(img)
    } else {
      this._uploadImages([img])
    }
  }

  _uploadImages = (images) => {
    ShowLoading()
    uploadImgs({ localImgs: images }).then((result) => {
      if (result.length > 0) {
        this._uploadImage(result)
      } else {
        CommonToast('图片上传失败')
        DismissLoading()
      }
    })
  }

  _uploadImage = (userArchiveImgModels = []) => {
    const { userinfoC, updateUserArchiveImg } = this.props
    insertImg({
      params: {
        userId: userinfoC.userId,
        imgUrls: userArchiveImgModels.join(',')
      }
    }).then((data) => {
      const newDataArr = data.data ? data.data.map((item) => {
        item.url = ImageHost + item.imgUrl
        return item
      }) : []
      this.setState({
        dataPhotoArr: newDataArr
      })
      updateUserArchiveImg({
        userArchiveImgModels: newDataArr
      })
      DismissLoading()
    }).catch((data) => {
      DismissLoading()
    })
  }

  _showImageViewer = () => {
    const { dataPhotoArr, initIndex } = this.state
    this.imgageViewerModal = showImageViewerModal({
      onClose: this._closeImageViewerModal,
      images: dataPhotoArr,
      initIndex
    })
  }

  _closeImageViewerModal = () => {
    if (this.imgageViewerModal) {
      this.imgageViewerModal.close()
    }
  }

  _transformDataArr = () => {
    const { userArchiveImgModels } = this.props
    const returnData = userArchiveImgModels.map((item) => {
      item.url = ImageHost + item.imgUrl
      return item
    })
    return returnData
  }

  _renderItem = ({ item, index }) => {
    return (
      <CustomButton
        style={[styles.itemView, { marginRight: index % 3 === 2 ? 0 : ScaleS(4) }]}
        params={{ item, index }}
        onPress={this._imgItemClick}
      >
        <CustomImage
          style={styles.photoImg}
          source={{ uri: item.url }} />
      </CustomButton>
    )
  }

  _imgItemClick = ({ item, index }) => {
    this.setState({
      initIndex: index
    }, () => {
      this._showImageViewer()
    })
  }

  _keyExtractor = item => item.id
  // 操作相册结束

  /**
   * 渲染每一个屏
   * @param route
   * @param jumpTo
   * @returns {*}
   * @private
   */
  _renderScene = ({ route, jumpTo }) => {
    switch (route.key) {
      case 'resume':
        return this._renderResumeComponent()
    }
  }
  _createAreaData() {
    let that = this;
    let area = address;
    let data = [];
    let len = area.length;
    for (let i = 0; i < len; i++) {
      let city = [];
      for (let j = 0, cityLen = area[i]['cityModels'].length; j < cityLen; j++) {
        let _city = {};
        _city[area[i]['cityModels'][j]['name']] = that.getAreadData(area[i]['cityModels'][j]);
        city.push(_city);
      }
      let _data = {};
      _data[area[i]['name']] = city;
      data.push(_data);
    }
    return data;
  }
  getAreadData(res) {
    let data = [];
    res.cityModels.map(function (item, index) {
      data.push(item.name);
    });
    return data;
  }
  _birthFieldClick = ({ item, index }) => {
    if (this.props.roleC) {

      const schoolSave = (value) => {
        if (item.abbreviation !== 'birthplace' && item.abbreviation !== 'address') {
          this.state.templateList[index].text = value
          this.setState({
            templateList: [...this.state.templateList]
          })
        }
      }
      const pickerTitleText = item.resumeTemplateName
      // 地址
      if (item.abbreviation == 'birthplace' || item.abbreviation == 'address') {
        let selectedValue = item.text ? item.text : []
        if (item.text && typeof item.text == 'string') {
          selectedValue = JSON.parse(item.text)
        }
        const pickerData = this._createAreaData()
        showPicker({
          pickerData,
          selectedValue,
          pickerTitleText,
          onConfirm: (item) => {
            this.state.templateList[index].text = item
            this.setState({
              templateList: [...this.state.templateList]
            })
          }
        })
        return
      }
      // 学校名次
      if (item.abbreviation == 'ranking') {
        const years = [
          '<10%',
          '<30%',
          '其他'
        ]
        let pickerData = years
        const selectedValue = item.text ? [item.text] : []
        showPicker({
          pickerData,
          selectedValue,
          pickerTitleText,
          onConfirm: ([gmtBorth]) => {
            this.state.templateList[index].text = gmtBorth
            this.setState({
              templateList: [...this.state.templateList]
            })
          }
        })
        return
      }
      let regexp = ''
      if (item.abbreviation == 'idCard') {
        regexp = /^[1-9]\d{5}(18|19|20|(3\d))\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/
      } else if (item.abbreviation == 'mobile') {
        regexp = /^1[3456789]\d{9}$/
      } else if (item.abbreviation == 'email') {
        regexp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/
      }
      this.props.navigation.navigate('CommonInputListPage', {
        title: item.resumeTemplateName,
        value: item ? item.text : '',
        desc: '',
        placeholder: `请输入${item.resumeTemplateName}`,
        maxLength: 46,
        regexp: regexp,
        saveCallback: schoolSave,
        associativeRequest: this._schoolAssociative
      })
    }
  }
  _schoolAssociative = (editValue) => {
    return new Promise((resolve) => {
      resolve(getSchoolQuery(this.allSchools, editValue))
    })
  }

  updateUserResume = (type) => {
    this.showDotModal.close(() => {
      updateUserResume({ params: { type, id: this.state.resumeId } }).then((data) => {
        this.getfindUserResumeByUserId()
        CommonToast('操作成功')
      })
    })
  }

  cancelUpdate = () => {
    cancelUpdate({ params: { id: this.state.resumeId } }).then((data) => {
      this.getfindUserResumeByUserId()
      CommonToast('操作成功')
    })
  }

  /**
   * 渲染简历
   * @returns {*}
   * @private
   */
  _renderResumeComponent = () => {
    const {
      jobHuntingModels, userArchiveWorkModels, educations, intro
    } = this.props
    const { dataPhotoArr, templateList, resumeType } = this.state
    return (
      <Fragment>
        <View style={[styles.jobIntentionView, {}]}>
          <View style={styles.rightIcon}>
            <CustomImage
              style={styles.rightIconText}
              source={this.props.roleC ? require('@/imgC/template/bqxx.png') : require('@/imgC/template/bqxx.png')}
            />
          </View>
          <View style={[styles.jobIntentionTitleView, (!jobHuntingModels || jobHuntingModels.length <= 0) && styles.blankStyle]}>
            <CustomButton style={styles.jobHuntingTop}>
              <Text style={styles.jobIntentionTitleLabel}>{this.props.roleC ? '该岗位需要补全以下信息' : '定制信息'}</Text>
            </CustomButton>
            <View>
              {
                (templateList || []).map((item, index) => {
                  let text = '请选择'
                  if (item.text && (item.abbreviation == 'address' || item.abbreviation == 'birthplace')) {
                    if (item.text[0] !== item.text[1]) {
                      if (typeof item.text == 'string') {
                        text = JSON.parse(item.text).join('')
                      } else {
                        text = item.text.join('')
                      }
                    } else if (item.text) {
                      text = item.text[1] + item.text[2]
                    }
                  } else if (item.text) {
                    text = item.text
                  }
                  return <CompanyTouchableOpacity style={styles.companyTouchableOpacity} isArrowRight={!this.props.roleC} valueStyle={styles.valueStyle} titleStyle={styles.titleStyle} key={index} params={{ item, index }} onPress={this._birthFieldClick} title={item.resumeTemplateName} value={text} url={require('@/imgC/userinfo/arrow_black_right.png')} />
                })
              }
            </View>
          </View>
        </View>
        <View style={[styles.jobIntentionView, {}]}>
          <View style={styles.rightIcon}>
            <CustomImage
              style={styles.rightIconText}
              source={require('@/imgC/userinfo/icon_i.png')}
            />
          </View>
          <View style={[styles.jobIntentionTitleView, (!jobHuntingModels || jobHuntingModels.length <= 0) && styles.blankStyle]}>
            <CustomButton style={styles.jobHuntingTop} onPress={this._jumpIntentionPage}>
              <Text style={styles.jobIntentionTitleLabel}>求职意向</Text>
              {this.props.roleC && <View style={styles.titleDotView}>
                <View style={styles.titleDot}></View>
                <View style={styles.titleDot}></View>
                <View style={styles.titleDot}></View>
              </View>}
            </CustomButton>
            {
              !!jobHuntingModels && !!jobHuntingModels.length > 0 && jobHuntingModels.map((item, index) => {
                return (<JobIntentionCardNew
                  key={item.id}
                  style={{ marginTop: ScaleS(index === 0 ? 0 : 35) }}
                  dataSource={item} />)
              })
            }
          </View>
        </View>
        {
          (!jobHuntingModels || !!jobHuntingModels.length <= 0) && (
            <View style={styles.blankView}>
              <CustomImage style={styles.itemBlankImg} source={require('@/imgC/userinfo/blank_1.jpg')} />
            </View>
          )
        }

        <View style={styles.jobIntentionView}>
          <View style={styles.rightIcon}>
            <CustomImage
              style={styles.rightIconText}
              source={require('@/imgC/userinfo/icon_a.png')}
            />
          </View>
          <CustomButton style={[styles.jobIntentionTitleView, !intro && styles.blankStyle]} onPress={this._jumpSelfEvaluationPage}>
            <View style={[styles.jobHuntingTop, styles.selfAssessmentTitleTop]}>
              <Text style={styles.jobIntentionTitleLabel}>自我评价</Text>
              {this.props.roleC && <View style={styles.titleDotView}>
                <View style={styles.titleDot}></View>
                <View style={styles.titleDot}></View>
                <View style={styles.titleDot}></View>
              </View>}
            </View>
            {!!intro && <Text style={styles.selfAssessmentContent}>{intro}</Text>}
          </CustomButton>
        </View>
        {!intro &&
          <View style={styles.blankView}>
            <CustomImage style={styles.itemBlankImg} source={require('@/imgC/userinfo/blank_2.jpg')} />
          </View>}

        <View style={styles.jobIntentionView}>
          <View style={styles.rightIcon}>
            <CustomImage
              style={styles.rightIconText}
              source={require('@/imgC/userinfo/icon_e.png')}
            />
          </View>
          <View style={[styles.jobIntentionTitleView, (!educations || educations.length <= 0) && styles.blankStyle]}>
            <CustomButton style={styles.jobHuntingTop} onPress={this._jumpEducationPage}>
              <Text style={styles.jobIntentionTitleLabel}>教育信息</Text>
              {this.props.roleC && <View style={styles.titleDotView}>
                <View style={styles.titleDot}></View>
                <View style={styles.titleDot}></View>
                <View style={styles.titleDot}></View>
              </View>}
            </CustomButton>
            {
              !!educations && !!educations.length > 0 && educations.map((item, index) => {
                return (<EducationInfoCardNew
                  key={item.id}
                  style={{ marginTop: ScaleS(index === 0 ? 0 : 30) }}
                  dataSource={item} />)
              })
            }
          </View>
        </View>
        {
          (!educations || !!educations.length <= 0) && (
            <View style={styles.blankView}>
              <CustomImage style={styles.itemBlankImg} source={require('@/imgC/userinfo/blank_3.jpg')} />
            </View>
          )
        }

        {(this.props.roleC || (!this.props.roleC && !!userArchiveWorkModels && !!userArchiveWorkModels.length > 0)) && <View style={styles.jobIntentionView}>
          <View style={styles.rightIcon}>
            <CustomImage
              style={styles.rightIconText}
              source={require('@/imgC/userinfo/icon_w.png')}
            />
          </View>
          <View style={[styles.jobIntentionTitleView, (!userArchiveWorkModels || userArchiveWorkModels.length <= 0) && styles.blankStyle]}>
            <CustomButton style={styles.jobHuntingTop} onPress={this._jumpWorkExperience}>
              <Text style={styles.jobIntentionTitleLabel}>工作经验</Text>
              {this.props.roleC && <View style={styles.titleDotView}>
                <View style={styles.titleDot}></View>
                <View style={styles.titleDot}></View>
                <View style={styles.titleDot}></View>
              </View>}
            </CustomButton>
            {
              !!userArchiveWorkModels && !!userArchiveWorkModels.length > 0 && userArchiveWorkModels.map((item, index) => {
                return (<WorkExperienceCardNew
                  key={item.id}
                  style={{ marginTop: ScaleS(index === 0 ? 0 : 30) }}
                  dataSource={item} />)
              })
            }
          </View>
        </View>}
        {
          (this.props.roleC && (!userArchiveWorkModels || !!userArchiveWorkModels.length <= 0)) && (
            <View style={styles.blankView}>
              <CustomImage style={styles.itemBlankImg} source={require('@/imgC/userinfo/blank_5.jpg')} />
            </View>
          )
        }

        {(this.props.roleC || (!this.props.roleC && !!dataPhotoArr && !!dataPhotoArr.length)) && <View style={styles.jobIntentionView}>
          <View style={styles.rightIcon}>
            <CustomImage
              style={styles.rightIconText}
              source={require('@/imgC/userinfo/icon_p.png')}
            />
          </View>
          <View style={[styles.photoView, (!dataPhotoArr || dataPhotoArr.length <= 0) && styles.blankStyle]}>
            <CustomButton style={styles.jobHuntingTop} onPress={this._jumpMyPhoneAlbums}>
              <Text style={styles.jobIntentionTitleLabel}>我的相册</Text>
              {this.props.roleC && <View style={styles.titleDotView}>
                <View style={styles.titleDot}></View>
                <View style={styles.titleDot}></View>
                <View style={styles.titleDot}></View>
              </View>}
            </CustomButton>
            {!!dataPhotoArr && dataPhotoArr.length > 0 && <FlatList
              style={styles.photoAlbumScrollView}
              data={dataPhotoArr}
              horizontal={false}
              numColumns={3}
              renderItem={this._renderItem}
              keyExtractor={this._keyExtractor} />}
          </View>
        </View>}
        {
          ((this.props.roleC && (!dataPhotoArr || dataPhotoArr.length <= 0))) && (
            <View style={styles.blankView}>
              <CustomImage style={styles.itemBlankImg} source={require('@/imgC/userinfo/blank_4.jpg')} />
            </View>
          )
        }
        {this.props.roleC && <View style={styles.resumeFragment}>
        </View>}
        {/* {
          !this.props.roleC && <View style={styles.roleB}>
            {!!resumeType === 1 && <View style={styles.roleBView}>
              <View style={styles.roleBViewLeft}>
                <View style={styles.roleBViewLeftView}></View>
                <Text style={styles.roleBViewLeftText}>不合适</Text>
              </View>
              <CustomButton onPress={this.cancelUpdate} style={styles.roleBTopViewRight}>
                <Text style={styles.roleBViewText}>取消</Text>
              </CustomButton>
            </View>}
            {(!!resumeType !== 1) && <View style={styles.roleBView}>
              <View style={styles.roleBViewLeft}>
                <View style={styles.roleBViewLeftView}></View>
                <Text style={styles.roleBViewLeftText}>{resumeType === 2 ? '录用' : resumeType === 0 ? '审核' : resumeType == 3 ? '初试' : resumeType == 4 ? '复试' : resumeType == 5 ? '三试' : resumeType == 6 ? '四试' : ''}中...</Text>
              </View>
              {!!resumeType !== 2 && <CustomButton onPress={this._threeDotPress} style={styles.roleBTopViewRight}>
                <Text style={styles.roleBViewText}>操作</Text>
              </CustomButton>}
            </View>}
          </View>
        } */}
      </Fragment>
    )
  }

  _threeDotPress = item => {
    const { resumeType } = this.state
    this.dotArr = []
    // 没有举报
    this.dotArr.push({
      label: '不合适',
      type: 1
    })
    if (resumeType !== 1 && resumeType !== 2 && resumeType !== 6) {
      this.dotArr.push({
        label: `邀请${resumeType === 0 ? '初试' : resumeType == 3 ? '复试' : resumeType === 4 ? '三试' : resumeType == 5 ? '四试' : ''}`,
        type: resumeType == 0 ? 3 : resumeType >= 3 ? resumeType + 1 : ''
      })
    }
    if (resumeType !== 0) {
      this.dotArr.push({
        label: '直接录用',
        type: 2
      })
    }
    this.threeDotPress(item)
  }

  threeDotPress = item => {
    this.showDotModal = showModal(this._threeDotModal(item))
  }

  _threeDotModal = params => {
    return (
      <WhiteWrap>
        <ThreeDotComponent
          dataArr={this.dotArr}
          params={params}
          itemClick={this._itemDotClick}
        />
      </WhiteWrap>
    )
  }

  _itemDotClick = ({ item }) => {
    this.updateUserResume(item.type)
  }

  /**
   * 切换标签
   * @param index
   * @private
   */
  _onIndexChange = (index) => {
    this.setState({ index })
  }

  /**
   * 渲染tabBar
   * @param props
   * @returns {*}
   * @private
   */
  _renderTabBar = (props) => {
    const { navigationState: { index, routes } } = props
    return (
      <View style={styles.tabContainer}>
        <CustomButton style={styles.tabItem} onPress={this._tabBarClick} params={{ props, key: routes[0].key }}>
          <Text style={[styles.tabItemText, index === 0 && styles.tabItemActive]}>{routes[0].title}</Text>
        </CustomButton>
      </View>
    )
  }

  _tabBarClick = ({ props, key }) => { }
}

export default CMinePage
const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#FFFFFF'
  },
  topText: {
    flexDirection: 'row',
    marginLeft: ScaleS(150)
  },
  shareBtn: {
    marginLeft: ScaleS(150)
  },
  shareBar: {
    paddingTop: IS_IPHONEX ? ScaleS(52) : ScaleS(32),
    // paddingTop: ScaleS(52),
    flexDirection: 'row',
    justifyContent: 'flex-end',
    marginHorizontal: ScaleS(20)
  },
  titleView: {
    marginTop: ScaleS(20),
    flexDirection: 'row',
    marginHorizontal: ScaleS(20)
  },
  titlePortraitBtn: {},
  titlePortraitImg: {
    width: ScaleS(90),
    height: ScaleS(90),
    resizeMode: 'cover',
    borderRadius: ScaleS(45)
  },
  titleLeft: {
    flex: 1,
    flexDirection: 'column',
    paddingTop: ScaleS(15)
  },
  titleCenterView: {
    // alignItems: 'flex-start'
  },
  jobHuntingView: {
    flexDirection: 'row',
    marginTop: ScaleS(15)
  },
  jobHuntingImg: {
    marginRight: ScaleS(5)
  },
  jobHuntingText: {
    fontSize: ScaleS(14),
    color: '#3C3C3C'
  },
  titleCenterName: {
    color: '#3C3C3C',
    fontSize: ScaleT(22),
    fontWeight: '900'
  },
  titleRightImg: {
    width: 26,
    height: 26,
    marginTop: 3
  },
  titleInfo: {
    flexDirection: 'row',
    paddingHorizontal: ScaleS(20),
    marginTop: ScaleS(36),
    justifyContent: 'space-between'
  },
  infoContainer: {
    flex: 1,
    flexDirection: 'row',
    alignItems: 'flex-end',
    justifyContent: 'space-between',
    marginTop: ScaleS(50),
    marginHorizontal: ScaleS(20),
    paddingBottom: ScaleS(19),
    borderBottomColor: '#f1f1f1',
    borderBottomWidth: ONE_PIXEL,
    borderStyle: 'solid'
  },
  infoContainerLeft: {
    flexDirection: 'row',
    alignItems: 'center'
  },
  followInfo: {
    flexDirection: 'column',
    alignItems: 'center',
    marginRight: ScaleS(40)
  },
  followInfoTop: {
    fontSize: ScaleT(20),
    fontWeight: 'bold',
    color: '#3C3C3C'
  },
  followInfoBottom: {
    fontSize: ScaleT(11),
    color: '#9E9E9E',
    marginTop: ScaleS(5)
  },
  infoContainerRight: {
    flexDirection: 'row'
  },
  followBtn: {
    width: ScaleS(50),
    height: ScaleS(30),
    backgroundColor: 'rgba(74,74,74,1)',
    borderRadius: ScaleS(4),
    justifyContent: 'center',
    alignItems: 'center',
    marginRight: ScaleS(10)
  },
  followBtnText: {
    fontSize: ScaleT(18),
    fontWeight: 'bold',
    color: '#fff'
  },
  goChatBtn: {
    width: ScaleS(70),
    height: ScaleS(30),
    backgroundColor: 'rgba(255,228,0,1)',
    borderRadius: ScaleS(4),
    justifyContent: 'center',
    alignItems: 'center'
  },
  goChatBtnText: {
    fontSize: ScaleT(12),
    fontWeight: '500',
    color: '#000'
  },
  selfAssessmentContent: {
    color: '#818181',
    fontSize: ScaleT(14),
    fontWeight: '300',
    lineHeight: ScaleT(28)
  },
  jobIntentionView: {
    flex: 1,
    flexDirection: 'row',
    justifyContent: 'flex-start',
    marginHorizontal: ScaleS(20),
    marginTop: ScaleS(20)
  },
  jobIntentionTitleView: {
    flex: 1,
    flexDirection: 'column',
    paddingBottom: ScaleS(28),
    borderBottomColor: 'rgba(151, 151, 151, 0.25)',
    borderBottomWidth: ONE_PIXEL,
    borderStyle: 'solid'
  },
  photoView: {
    flex: 1,
    flexDirection: 'column',
    paddingBottom: ScaleS(30)
  },
  jobHuntingTop: {
    width: '100%',
    height: ScaleS(22),
    flexDirection: 'row',
    justifyContent: 'space-between',
    alignItems: 'center',
    marginBottom: ScaleS(22)
  },
  selfAssessmentTitleTop: {
    marginBottom: ScaleS(14)
  },
  jobIntentionTitleLabel: {
    color: '#3C3C3C',
    fontSize: ScaleT(16),
    fontWeight: '500'
  },
  titleDotView: {
    flex: 1,
    justifyContent: 'flex-end',
    flexDirection: 'row',
    alignItems: 'center'
  },
  titleDot: {
    width: ScaleS(4),
    height: ScaleS(4),
    borderRadius: ScaleS(2),
    backgroundColor: '#666666',
    marginRight: ScaleS(4)
  },
  selfTitleLabel: {
    color: '#3C3C3C',
    fontSize: ScaleT(16),
    fontWeight: '500',
    flex: 1,
    marginBottom: ScaleS(18),
    marginTop: ScaleS(3)
  },
  photoAlbumScrollView: {
    flex: 1
  },
  itemView: {
    width: ScaleS(98),
    height: ScaleS(98),
    marginBottom: ScaleS(4)
  },
  photoImg: {
    width: ScaleS(98),
    height: ScaleS(98),
    resizeMode: 'cover'
  },
  tabContainer: {
    flexDirection: 'row',
    paddingHorizontal: ScaleS(20),
    marginTop: ScaleS(22),
    // marginBottom: ScaleS(20),
    alignItems: 'center'
  },
  tabItem: {
    // marginRight: ScaleS(29)
  },
  tabLine: {
    width: ONE_PIXEL,
    height: ScaleS(10),
    backgroundColor: '#d5d5d5',
    marginHorizontal: ScaleS(20)
  },
  tabItemText: {
    fontSize: ScaleT(13),
    fontWeight: '500',
    color: '#999999'
  },
  tabItemActive: {
    color: '#3C3C3C',
    fontWeight: '900'
  },
  rightIcon: {
    width: ScaleS(22),
    height: ScaleS(22),
    marginRight: ScaleS(10)
  },
  rightIconText: {
  },
  titleInfoItem: {
    flex: 1
  },
  myResumeView: {
    marginTop: ScaleS(35),
    paddingHorizontal: ScaleS(20)
  },
  myResumeContentView: {
    marginTop: ScaleS(40),
    paddingHorizontal: ScaleS(20)
  },
  myResumeContentItemVIew: {
    marginTop: ScaleS(36)
  },
  jobRecommendView: {
    marginTop: ScaleS(39)
  },
  completeMyResumeView: {
    flexDirection: 'row',
    alignItems: 'center'
  },
  completeMyResumeLabel: {
    fontSize: 12
  },
  resumeLine: {
    width: 1,
    backgroundColor: 'lightgrey',
    marginHorizontal: 5,
    height: '100%'
  },
  completeMyResume: {
    fontSize: 12,
    paddingHorizontal: 5,
    paddingVertical: 3,
    borderRadius: 3,
    borderWidth: 1,
    borderStyle: 'solid',
    borderColor: 'lightgrey'
  },
  mineHorizontalLine: {
    height: 2,
    backgroundColor: 'white'
  },
  jobRecommendItemView: {
    borderRadius: ScaleS(10),
    width: ScaleS(177),
    marginRight: ScaleS(15)
  },
  serviceConsultationView: {
    marginVertical: ScaleS(40),
    marginHorizontal: ScaleS(20),
    alignItems: 'center',
    flexDirection: 'row',
    justifyContent: 'space-between'
  },
  serviceConsultation: {
    color: '#444444',
    fontSize: ScaleT(19),
    fontWeight: '500'
  },
  servicePhone: {
    color: '#A5A5A5',
    fontSize: ScaleT(12),
    fontWeight: '400',
    marginTop: ScaleS(6)
  },
  mine: {
    marginTop: ScaleS(40),
    flexDirection: 'row',
    justifyContent: 'space-between'
  },
  mineLeft: {
    marginLeft: ScaleS(20),
    justifyContent: 'center',
    alignItems: 'center',
    flexDirection: 'row'
  },
  mineButton: {
    marginRight: ScaleS(20),
    paddingTop: ScaleS(5),
    paddingBottom: ScaleS(5),
    paddingRight: ScaleS(13),
    paddingLeft: ScaleS(13),
    backgroundColor: 'rgba(255,249,233,1)',
    borderRadius: ScaleS(15)
  },
  mineButtontext: {
    fontWeight: '700',
    color: 'rgba(255,198,28,1)',
    fontSize: ScaleT(14)
  },
  mineLeftTitle: {
    fontSize: ScaleT(25),
    fontWeight: '500',
    color: '#000000'
  },
  mineLeftPerfectLimit: {
    fontWeight: '400',
    fontSize: ScaleT(14),
    color: 'rgba(153,153,153,1)'
  },
  PerfectLimit: {
    fontWeight: '400',
    fontSize: ScaleT(14),
    color: 'rgba(255, 194, 0, 1)'
  },
  PerfectLimitView: {
    marginLeft: ScaleS(6),
    flexDirection: 'row'
  },
  blankView: {
    flex: 1,
    flexDirection: 'row',
    justifyContent: 'flex-end',
    borderBottomColor: '#000',
    borderStyle: 'solid',
    borderBottomWidth: ScaleS(1),
    marginHorizontal: ScaleS(20),
    marginBottom: ScaleS(20)
  },
  itemBlankImg: {
  },
  blankStyle: {
    borderBottomWidth: 0,
    paddingBottom: ScaleS(20)
  },
  bottom: {
    width: '100%',
    height: ScaleS(54),
    position: 'absolute',
    bottom: 0,
    flexDirection: 'row',
    backgroundColor: 'rgba(249, 249, 249, 1)',
    justifyContent: 'flex-end',
    alignItems: 'center'
  },
  touchableOpacity: {
    borderColor: '#EFEFEF',
    borderStyle: 'solid',
    borderBottomWidth: ONE_PIXEL
  },
  bottomBotton: {
    width: ScaleS(60),
    height: ScaleS(32),
    backgroundColor: 'rgba(255, 228, 0, 1)',
    marginRight: ScaleS(20),
    borderRadius: ScaleS(4),
    justifyContent: 'center',
    alignItems: 'center'
  },
  bottomBottonText: {
    fontSize: ScaleS(12),
    color: 'rgba(0, 0, 0, 1)'
  },
  roleB: {},
  roleBView: {
    flexDirection: 'row',
    paddingHorizontal: ScaleS(20),
    alignItems: 'center',
    justifyContent: 'space-between',
    height: ScaleS(55),
    backgroundColor: 'rgba(249,249,249,1)',
    marginBottom: ScaleS(25)
  },
  roleBViewLeft: {
    flexDirection: 'row',
    alignItems: 'center'
  },
  roleBViewLeftView: {
    width: ScaleS(6),
    height: ScaleS(6),
    borderRadius: ScaleS(3),
    marginRight: ScaleS(8),
    backgroundColor: 'rgba(254, 221, 0, 1)'
  },
  roleBViewLeftText: {
    fontSize: ScaleS(13),
    color: 'rgba(60, 60, 60, 1)',
    fontWeight: '400'
  },
  roleBTopViewRight: {
    height: ScaleS(32),
    width: ScaleS(68),
    marginRight: ScaleS(10),
    borderRadius: ScaleS(4),
    backgroundColor: 'rgba(255,228,0,1)',
    alignItems: 'center',
    justifyContent: 'center'
  },
  roleBViewText: {
    fontSize: ScaleS(12),
    color: 'rgba(0, 0, 0, 1)',
    fontWeight: '500'
  },
  titleStyle: {
    fontSize: ScaleS(14),
    color: 'rgba(129, 129, 129, 1)',
    fontWeight: '300'
  },
  valueStyle: {
    width: ScaleS(150),
    fontSize: ScaleS(14),
    fontWeight: '300',
    color: 'rgba(0, 0, 0, 1)'
  },
  resumeFragment: {
    marginBottom: ScaleS(71)
  },
  communicateContainer: {
    width: WIDTH,
    flexDirection: 'column'
  },
  communicateLogo: {
    width: WIDTH,
    // height: ScaleS(130),
    backgroundColor: '#fff',
    opacity: 0,
    flexDirection: 'row',
    justifyContent: 'flex-end'
  },
  communicateLogoImg: {},
  communicateOutView: {
    flexDirection: 'row',
    justifyContent: 'space-between',
    alignItems: 'center',
    backgroundColor: '#F9F9F9',
    paddingHorizontal: ScaleS(20),
    paddingTop: ScaleS(12),
    paddingBottom: IS_IPHONEX ? ScaleS(32) : ScaleS(12)
  },
  activeTime: {
    flexDirection: 'row',
    alignItems: 'center'
  },
  activeTimeDot: {
    width: ScaleS(6),
    height: ScaleS(6),
    marginRight: ScaleS(8),
    backgroundColor: '#FEDD00',
    borderRadius: ScaleS(3)
  },
  activeTimeText: {
    fontSize: ScaleS(13),
    color: '#3C3C3C'
  },
  communicateShadowView: {
    width: ScaleS(254),
    height: ScaleS(50),
    shadowOffset: {
      width: ScaleS(0),
      height: ScaleS(6)
    },
    shadowColor: '#EB546B',
    shadowOpacity: 0.45,
    shadowRadius: ScaleS(29),
    borderRadius: ScaleS(25)
  },
  communicateView: {
    width: ScaleS(70),
    height: ScaleS(30),
    alignItems: 'center',
    justifyContent: 'center',
    flexDirection: 'row',
    backgroundColor: '#FFE400',
    borderRadius: ScaleS(4)
  },
  communicateLabel: {
    color: '#000000',
    fontSize: ScaleT(12),
    fontWeight: '500'
  },
  communicateRightView: {
    flexDirection: 'row'
  },
  companyTouchableOpacity: {
    height: ScaleS(46)
  }
})
